package org.parademo.model;

import java.util.Random;

/**
 * @author Ajit Skanda
 * @version 1.0
 */
public class VoteEntity extends Entity {

    private Long memberId;
    private Long proposalId;
    private long tokens;
    private boolean approved;

	public VoteEntity(Long pMemberId, Long pProposalId, long pTokens, boolean pApproved) {
		this.id = new Random().nextLong();
		this.memberId = pMemberId;
		this.proposalId = pProposalId;
		this.tokens = pTokens;
		this.approved = pApproved;
	}

	public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long pMemberId) {
	    Long oldMemberId = memberId;
        memberId = pMemberId;
	    pcs.firePropertyChange("memberId", oldMemberId, pMemberId);
    }

    public Long getProposalId() {
        return proposalId;
    }

    public void setProposalId(long pProposalId) {
	    Long oldProposalId = proposalId;
        proposalId = pProposalId;
	    pcs.firePropertyChange("proposalId", oldProposalId, pProposalId);
    }

    public long getTokens() {
        return tokens;
    }

    public void setTokens(long pTokens) {
	    long oldTokens = tokens;
        tokens = pTokens;
	    pcs.firePropertyChange("tokens", oldTokens, pTokens);
    }

    public boolean isApproved() {
        return approved;
    }

    public void setApproved(boolean pApproved) {
	    boolean oldApp = approved;
        approved = pApproved;
	    pcs.firePropertyChange("approved", oldApp, pApproved);
    }
}
